home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Screens / DoubleBuffer.s < prev    next >
Encoding:
Text File  |  1997-07-09  |  2.3 KB  |  99 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Double Buffer
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This just shows how to double buffer the screen.  You can also try out
  7. ;triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
  8. ;GameScreen.
  9.  
  10.     INCDIR    "INCLUDES:"
  11.     INCLUDE    "games/games_lib.i"
  12.     INCLUDE    "games/games.i"
  13.  
  14.     SECTION    "Demo",CODE
  15.  
  16. ;===========================================================================;
  17. ;                             INITIALISE DEMO
  18. ;===========================================================================;
  19.  
  20.     STARTGMS
  21.  
  22. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  23.     move.l    GMSBase(pc),a6
  24.     lea    ScreenTags(pc),a0    ;Add screen for use.
  25.     CALL    AddScreen
  26.     tst.l    d0
  27.     beq.s    .Error_Screen
  28.  
  29.     move.l    Screen(pc),a0
  30.     lea    PictureTags(pc),a1    ;Load background picture.
  31.     move.l    GS_MemPtr1(a0),PicData
  32.     CALL    LoadPic
  33.     tst.l    d0
  34.     beq.s    .Error_Picture
  35.  
  36.     move.l    Screen(pc),a0
  37.     move.l    Picture(pc),a1
  38.     move.l    PIC_Palette(a1),GS_Palette(a0)
  39.     CALL    UpdatePalette
  40.  
  41.     move.l    Screen(pc),a0
  42.     CALL    ShowScreen
  43.  
  44.     bsr.s    Main
  45.  
  46. .ReturnToDOS
  47.     move.l    GMSBase(pc),a6
  48.     move.l    Picture(pc),a1
  49.     CALL    FreePic
  50. .Error_Picture
  51.     move.l    Screen(pc),a0
  52.     CALL    DeleteScreen    ;Give back screen memory etc.
  53. .Error_Screen
  54.     MOVEM.L    (SP)+,A0-A6/D1-D7
  55.     moveq    #ERR_OK,d0
  56.     rts
  57.  
  58. ;===========================================================================;
  59. ;                                MAIN LOOP
  60. ;===========================================================================;
  61.  
  62. Main:    move.l    Screen(pc),a0
  63.     CALL    WaitVBL    ;Nice VBL wait for multi-tasking.
  64.     CALL    SwapBuffers
  65.     moveq    #JPORT1,d0
  66.     moveq    #JT_ZBXY,d1
  67.     CALL    ReadJoyPort
  68.     btst    #MB_LMB,d0
  69.     beq.s    Main
  70.     rts
  71.  
  72. ;===========================================================================;
  73. ;                                  DATA
  74. ;===========================================================================;
  75.  
  76. ScreenTags:
  77.     dc.l    TAGS_GAMESCREEN
  78. Screen:    dc.l    0
  79.     dc.l    GSA_ScrWidth,320
  80.     dc.l    GSA_ScrHeight,256
  81.     dc.l    GSA_Attrib,DBLBUFFER
  82.     dc.l    GSA_AmtColours,32
  83.     dc.l    TAGEND
  84.  
  85. PictureTags:
  86.     dc.l    TAGS_PICTURE
  87. Picture    dc.l    0
  88.     dc.l    PCA_Data
  89. PicData    dc.l    0
  90.     dc.l    PCA_Width,320
  91.     dc.l    PCA_Height,256
  92.     dc.l    PCA_AmtColours,32
  93.     dc.l    PCA_Options,GETPALETTE
  94.     dc.l    PCA_File,.file
  95.     dc.l    TAGEND
  96.  
  97. .file    dc.b    "GMS:demos/data/PIC.Green",0
  98.     even
  99.